package com.jacken.mars.controller;

import com.jacken.mars.service.IMailService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wq
 * @version 1.0
 * @date 2021/1/8 11:37
 */
@RestController
@RequestMapping("/mail")
@AllArgsConstructor
public class MailController {

    private final IMailService mailService;

    /**
     * 简单发送
     * @return
     */
    @GetMapping("/send")
    public String sendMail() {
        mailService.sendSimpleMail("今日APP用户数据概览", "APP访问数:123,APP注册数:2134");
        return "发送成功";
    }

    /**
     * 发送html邮件
     * @return
     */
    @GetMapping("/sendHtmlMail")
    public String sendHtmlMail() {
        String img="https://img.imlianka.com/1565516110456362.jpg?size=671x670";
        mailService.sendHtmlMail("测试", "<img src='"+img+"'>");
        return "发送成功";
    }


    /**
     * 发送带附件的邮件
     * @return
     */
    @GetMapping("/sendAttachmentsMail")
    public String sendAttachmentsMail() {
        mailService.sendAttachmentsMail("测试", "APP访问数:123,APP注册数:2134","https://img.imlianka.com/1565516110456362.jpg?size=671x670");
        return "发送成功";
    }
}
